home *** CD-ROM | disk | FTP | other *** search
- class BackgroundMask extends MovieClip
- {
- var rad;
- var l;
- var r;
- var sx;
- var sy;
- var col;
- var mask;
- var lo;
- var ro;
- var ft = 1;
- static var cd = 2.8;
- static var bf = new flash.filters.BlurFilter(2,2,1);
- static var flashOn = {aa:100,ab:0,ra:100,rb:3,ga:100,gb:3,ba:100,bb:3};
- static var flashOff = {aa:100,ab:0,ra:100,rb:0,ga:100,gb:0,ba:100,bb:0};
- function BackgroundMask()
- {
- super();
- if(!_root.brdcst)
- {
- _root.brdcst = {};
- AsBroadcaster.initialize(_root.brdcst);
- }
- _root.brdcst.addListener(this);
- this.rad = Math.sqrt(this.l._x * this.l._x + this.l._y * this.l._y);
- this.l._visible = false;
- this.r._visible = false;
- this.sx = this._x;
- this.sy = this._y;
- this.cacheAsBitmap = true;
- this.col = new Color(this);
- }
- function drawMask()
- {
- this.mask.clear();
- this.mask.beginFill(0,100);
- var _loc2_ = {x:0,y:0};
- this.lo.localToGlobal(_loc2_);
- var _loc3_ = Math.floor(_loc2_.x);
- this.mask.moveTo(_loc3_,Stage.height);
- this.mask.lineTo(_loc3_,_loc2_.y);
- _loc2_ = {x:0,y:0};
- this.l.localToGlobal(_loc2_);
- var _loc5_ = _loc2_.y;
- this.mask.lineTo(_loc2_.x,_loc2_.y);
- _loc2_ = {x:0,y:0};
- this.r.localToGlobal(_loc2_);
- this.mask.lineTo(_loc2_.x,_loc2_.y);
- _loc2_ = {x:0,y:0};
- this.ro.localToGlobal(_loc2_);
- var _loc4_ = Math.ceil(_loc2_.x);
- this.mask.lineTo(_loc4_,_loc2_.y);
- this.mask.lineTo(_loc4_,Stage.height);
- this.mask.lineTo(_loc3_,Stage.height);
- this.mask.endFill();
- }
- function initMask(lc, rc)
- {
- this.lo = lc;
- this.ro = rc;
- this.mask = _root.createEmptyMovieClip(this._name + "_mask",_root.getNextHighestDepth());
- this.setMask(this.mask);
- }
- function endRace()
- {
- this.setMask(null);
- this.mask.removeMovieClip();
- }
- function xaty(x, top)
- {
- if(Math.abs(x) > this.rad)
- {
- return undefined;
- }
- var _loc2_ = !top ? 1 : -1;
- return this._y + _loc2_ * (this.rad * Math.cos(Math.asin((x - this._x) / this.rad)));
- }
- function setFilter(t)
- {
- t = t != undefined ? t : this.filters.length > 0;
- if(t)
- {
- this.filters = null;
- }
- else
- {
- this.filters = [BackgroundMask.bf];
- }
- }
- function flashingOff()
- {
- this.col.setTransform(BackgroundMask.flashOff);
- }
- function bright(t)
- {
- if(t)
- {
- this.col.setTransform(BackgroundMask.flashOn);
- }
- else
- {
- this.col.setTransform(BackgroundMask.flashOff);
- }
- }
- }
-